<template>
  <a-config-provider :locale="localeName==='zh_CN' ?  zhCN : esES">
    <router-view/>
  </a-config-provider>
</template>

<script>
import {ref, defineComponent, reactive, onMounted, watch} from 'vue'
import zhCN from 'ant-design-vue/es/locale/zh_CN';
import esES from 'ant-design-vue/es/locale/es_ES';
import {throttle} from '@/utils/index'
import {useStore} from 'vuex'
import {useRoute} from "vue-router";
import locale from "@/locale"

export default defineComponent({
  setup() {
    const store = useStore()
    const localeName = locale.global.locale
    const getPopupContainer = reactive({})

    function dispatchResize() {
      if (document.body.clientWidth <= 800) {
        store.commit('TOGGLE_DEVICE', 'mobile')
      } else {
        store.commit('TOGGLE_DEVICE', 'pc')
      }
    }

    onMounted(() => {
      dispatchResize()
      window.addEventListener('resize', throttle(dispatchResize, 100))
    })
    return {
      localeName,
      zhCN,
      esES
    }
  }
})
</script>

<style lang="less">
#app {
  font-family: "Helvetica Neue", Helvetica, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  width: 100%;
}

@primary-color: #1DA57A; // 全局主色
@link-color: #1890ff; // 链接色
@success-color: #52c41a; // 成功色
@warning-color: #faad14; // 警告色
@error-color: #f5222d; // 错误色
@font-size-base: 14px; // 主字号
@heading-color: rgba(0, 0, 0, 0.85); // 标题色
@text-color: rgba(0, 0, 0, 0.65); // 主文本色
@text-color-secondary: rgba(0, 0, 0, 0.45); // 次文本色
@disabled-color: rgba(0, 0, 0, 0.25); // 失效色
@border-radius-base: 4px; // 组件/浮层圆角
@border-color-base: #d9d9d9; // 边框色
@box-shadow-base: 0 2px 8px rgba(0, 0, 0, 0.15); // 浮层阴影
.ant-table-thead > tr > th, .ant-table-tbody > tr > td {
  padding: 16px 12px !important;
}
</style>
